#define _CRT_SECURE_NO_WARNINGS 1
#define _CRT_SECURE_NO_WARNINGS 1
#include<stdio.h>
#include<stdlib.h>
int main()
{
	int N = 0;
	int M = 0;
	int i = 0;
	int j = 0;
	int sum = 0;
	scanf("%d%d", &N, &M);
	int* arr = (int*)malloc(sizeof(int) * N * M);
	for (i = 0; i < N; i++)
	{
		for (j = 0; j < M; j++)
		{
			scanf("%d", &arr[i * M + j]);
		}
	}
	for (i = 0; i < N; i++)
	{
		for (j = 0; j < M; j++)
		{
			if (arr[i * M + j] > 0)
			{
				sum = sum + arr[i * M + j];
			}
		}
	}
	printf("%d", sum);
	free(arr);
	return 0;
}